/*

 * and open the template in the editor.
 */

package hcmus.fit.master.sevensea.control;

import java.util.ArrayList;
import java.util.List;

import android.graphics.Bitmap;
import android.graphics.Canvas;

/**
 * 
 * @author hvp
 */
public class Level {
    public static List Resources;
    public int LEVEL;
    public static Bitmap Icon;

    public Level(int level) {
        LEVEL = level;
    }

    public void Show(Canvas g, int x, int y) {
        List list = new ArrayList();
        int level = LEVEL;
        while (level > 0) {
            list.add(new Integer(level % 10));
            level /= 10;
        }
        if (list.size() <= 0)
            list.add(new Integer(0));
        x -= (list.size() * 14);
        // g.drawImage(Icon,x - 25, y-5, Graphics.TOP|Graphics.LEFT);

        for (int i = 0; i < list.size(); i++) {
            int num = ((Integer) list.get(list.size() - i - 1)).intValue();

            // Image tmp = (Image) Resources.get(num);
            // int w = tmp.getWidth();
            // int h = tmp.getHeight();
            // g.drawImage(tmp, x + i*w, y, Graphics.TOP|Graphics.LEFT);
            // g.DrawImage(tmp, new Rectangle(x + i*(w/2), y, w/2, h/2), 0, 0,
            // tmp.Width, tmp.Height,GraphicsUnit.Pixel, imgatt);
        }

    }

    public static List GetResource(Bitmap resource, int maxX, int maxY, int numerator, int denominator) {
        List rs = new ArrayList();
        int w = resource.getWidth() / maxX;
        int h = resource.getHeight() / maxY;

        // ImageAttributes imgatt = new ImageAttributes();
        // imgatt.SetColorKey(resource.GetPixel(0, 0), resource.GetPixel(0, 0));

        for (int i = 0; i < maxY; i++) {
            for (int j = 0; j < maxX; j++) {
                // Canvas tmp = Image.createImage(w, h);
                // Graphics g = tmp.getGraphics();
                // g.drawImage(resource, 0, 0, Graphics.TOP|Graphics.LEFT);
                // g.DrawImage(resource, new Rectangle(0, 0, w1, h1), j * w, i *
                // h, w, h, GraphicsUnit.Pixel, imgatt);
                // g.Dispose();
                // rs.add(tmp);
            }
        }
        return rs;
    }
}
